package com.xbongbong.paas.pojo.dto;

import com.alibaba.fastjson.JSONArray;
import com.xbongbong.paas.toolbox.wrap.BaseDTO;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;
import org.hibernate.validator.constraints.Range;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;

/**
 * @author long
 * @version v1.0
 * @date 2020/12/17 16:40
 * @since v1.0
 */
@Getter
@Setter
@ToString
public class ClueAutoAllocationSaveDTO extends BaseDTO {
    private static final long serialVersionUID = 7981475295810583072L;
    private Long id;
    @NotBlank(message = "{dto.msg.clueAutoAllocationSave.ruleName.NotBlank}")
    private String ruleName;

    @NotNull(message = "{dto.msg.clueAutoAllocationSave.formId.NotNull}")
    private Long formId;

    private Integer distributionLimit;

    @NotNull(message = "{dto.msg.clueAutoAllocationSave.allocationInterval.NotNull}")
    @Range(min = 0, max = 30, message = "{dto.msg.clueAutoAllocationSave.allocationInterval.Range}")
    private Integer allocationInterval;

    @NotNull(message = "{dto.msg.clueAutoAllocationSave.priority.NotNull}")
    private Integer priority;
    /**
     * 筛选条件
     */
    @NotNull(message = "{dto.msg.clueAutoAllocationSave.jsonData.NotNull}")
    private JSONArray jsonData;
    /**
     * 分配类型
     */
    @NotNull(message = "{dto.msg.clueAutoAllocationSave.allocationType.NotNull}")
    @Range(min = 0, max = 3, message = "{dto.msg.clueAutoAllocationSave.allocationType.Range}")
    private Integer allocationType;
    /**
     * 分配值
     * [
     *      {
     *          "user":["1", "2"],
     *          "num": 0,
     *      }
     * ]
     */
    @NotNull(message = "{dto.msg.clueAutoAllocationSave.allocationValue.NotNull}")
    private JSONArray allocationValue;
}
